package com.itheima.test2;

import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.net.ServerSocket;
import java.net.Socket;

public class ServerTest {
    public static void main(String[] args) throws IOException {
        ServerSocket ss = new ServerSocket(12349);
        Socket accept = ss.accept();
        InputStream is =accept.getInputStream();
        int b;
        while ((b=is.read())!=-1){
            System.out.println((char) b);
        }
        System.out.println("我和我");
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(accept.getOutputStream()));
        bw.write("你是谁?");
        bw.newLine();
        bw.flush();
        bw.close();
        ss.accept().shutdownOutput();//告诉客户端数据已经写完
        System.out.println("啊啊啊");
        is.close();
        accept.close();
        ss.close();

    }
}
